module app.controller.api.SocialController;

import hunt.framework;
import std.json;
import app.response.ResultMsg;
import app.utils.RespCodeEnun;

class SocialController : Controller
{
    mixin MakeController;

    /**
    * 社交信息，写死了
    */
    @Action Response index()
    {
        ResultMsg resultMsg = new ResultMsg;
        JSONValue[] items;

        // for (int i = 0; i < 4; i++)
        // {
        //     JSONValue item;
        //     item["id"] = i + 1;
        //     item["title"] = "QQ";
        //     item["icon"] = "iconqq";
        //     item["color"] = "#1AB6FF";
        //     item["href"] = "1186472484";
        //     items ~= item;
        // }

        JSONValue item1;
        item1["id"] = 1;
        item1["title"] = "QQ";
        item1["icon"] = "iconqq";
        item1["color"] = "#1AB6FF";
        item1["href"] = "http://wpa.qq.com/msgrd?v=3&uin=1186472484&site=qq&menu=yes";
        items ~= item1;

        JSONValue item2;
        item2["id"] = 2;
        item2["title"] = "Gitee";
        item2["icon"] = "icongitee";
        item2["color"] = "#d81e06";
        item2["href"] = "https://gitee.com/yuguofu/";
        items ~= item2;

        JSONValue item3;
        item3["id"] = 3;
        item3["title"] = "csdn";
        item3["icon"] = "iconcsdn";
        item3["color"] = "red";
        item3["href"] = "https://blog.csdn.net/weixin_44214243";
        items ~= item3;

        resultMsg.code = RespCodeEnun.SUCCESS;
        resultMsg.msg = "success";
        resultMsg.data["data"] = items;

        return new JsonResponse(resultMsg);
    }
}
